package com.huiyunetwork.porter;

import xyz.noark.core.annotation.Controller;
import xyz.noark.core.annotation.controller.GetMapping;
import xyz.noark.core.annotation.controller.ResponseBody;
import xyz.noark.core.env.EnvConfigHolder;
import xyz.noark.network.http.HttpServletRequest;

@Controller
public class TestController {

    @ResponseBody
    @GetMapping(path = "/", printLog = false)
    public String test(HttpServletRequest request) {
        StringBuilder sb = new StringBuilder();
        sb.append("Hi, Welcome to this service.\n\n\n");

        sb.append("你的IP地址：").append(request.getRemoteAddr()).append("\n");
        sb.append("我的端口：").append(EnvConfigHolder.getString("network.http.port")).append("\n");

        return sb.toString();
    }
}